﻿using System.Collections.ObjectModel;
using System.Data.Objects.DataClasses;
using System.Linq;

namespace FuckCore.DAO
{
    public interface IDAO<TEntity> where TEntity : EntityObject
    {
        /// <summary>
        /// Add object into database
        /// </summary>
        /// <para name="obj"></para>
        void Add(TEntity obj);

        /// <summary>
        /// Delete object from database
        /// </summary>
        /// <para name="obj"></para>
        void Delete(TEntity obj);

        /// <summary>
        /// Update object from database
        /// </summary>
        /// <para name="obj"></para>
        void Update(TEntity obj);

        /// <summary>
        /// Receive list object from database by query
        /// </summary>
        /// <para name="query"></para>
        /// <returns></returns>
        ReadOnlyCollection<TEntity> GetByQuery(IQueryable<TEntity> query);

        ///<summary>
        ///</summary>
        ///<param name="query"></param>
        ///<returns></returns>
        IQueryable<TEntity> Search(string query);
    }
}